<?xml version="1.0" encoding="ascii"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
          "DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
  <title>pypln.pypln.test_worker_processes</title>
  <link rel="stylesheet" href="epydoc.css" type="text/css" />
  <script type="text/javascript" src="epydoc.js"></script>
</head>

<body bgcolor="white" text="black" link="blue" vlink="#204080"
      alink="#204080">
<!-- ==================== NAVIGATION BAR ==================== -->
<table class="navbar" border="0" width="100%" cellpadding="0"
       bgcolor="#a0c0ff" cellspacing="0">
  <tr valign="middle">

  <!-- Tree link -->
      <th>&nbsp;&nbsp;&nbsp;<a
        href="module-tree.html">Trees</a>&nbsp;&nbsp;&nbsp;</th>

  <!-- Index link -->
      <th>&nbsp;&nbsp;&nbsp;<a
        href="identifier-index.html">Indices</a>&nbsp;&nbsp;&nbsp;</th>

  <!-- Help link -->
      <th>&nbsp;&nbsp;&nbsp;<a
        href="help.html">Help</a>&nbsp;&nbsp;&nbsp;</th>

  <!-- Project homepage -->
      <th class="navbar" align="right" width="100%">
        <table border="0" cellpadding="0" cellspacing="0">
          <tr><th class="navbar" align="center"
            ><a class="navbar" target="_top" href="http://code.google.com/p/pypln">Project Homepage</a></th>
          </tr></table></th>
  </tr>
</table>
<table width="100%" cellpadding="0" cellspacing="0">
  <tr valign="top">
    <td width="100%">
      <span class="breadcrumbs">
        Package&nbsp;pypln ::
        <a href="pypln.pypln-module.html">Package&nbsp;pypln</a> ::
        Module&nbsp;test_worker_processes
      </span>
    </td>
    <td>
      <table cellpadding="0" cellspacing="0">
        <!-- hide/show private -->
        <tr><td align="right"><span class="options">[<a href="javascript:void(0);" class="privatelink"
    onclick="toggle_private();">hide&nbsp;private</a>]</span></td></tr>
      </table>
    </td>
  </tr>
</table>
<h1 class="epydoc">Source Code for <a href="pypln.pypln.test_worker_processes-module.html">Module pypln.pypln.test_worker_processes</a></h1>
<pre class="py-src">
<a name="L1"></a><tt class="py-lineno"> 1</tt>  <tt class="py-line"><tt class="py-comment">#-*- coding:utf-8 -*-</tt> </tt>
<a name="L2"></a><tt class="py-lineno"> 2</tt>  <tt class="py-line"><tt class="py-docstring">"""</tt> </tt>
<a name="L3"></a><tt class="py-lineno"> 3</tt>  <tt class="py-line"><tt class="py-docstring">This testing module contains tests of the process methods of workers</tt> </tt>
<a name="L4"></a><tt class="py-lineno"> 4</tt>  <tt class="py-line"><tt class="py-docstring">These methods should be called directly, with a message, to avoid the need of starting</tt> </tt>
<a name="L5"></a><tt class="py-lineno"> 5</tt>  <tt class="py-line"><tt class="py-docstring">ventilators and worker processes communicating through ZMQ</tt> </tt>
<a name="L6"></a><tt class="py-lineno"> 6</tt>  <tt class="py-line"><tt class="py-docstring"></tt> </tt>
<a name="L7"></a><tt class="py-lineno"> 7</tt>  <tt class="py-line"><tt class="py-docstring">Created on 27/02/12</tt> </tt>
<a name="L8"></a><tt class="py-lineno"> 8</tt>  <tt class="py-line"><tt class="py-docstring">by Fl&#225;vio Code&#231;o Coelho</tt> </tt>
<a name="L9"></a><tt class="py-lineno"> 9</tt>  <tt class="py-line"><tt class="py-docstring">"""</tt> </tt>
<a name="L10"></a><tt class="py-lineno">10</tt>  <tt class="py-line"><tt class="py-name">__author__</tt> <tt class="py-op">=</tt> <tt class="py-string">'fccoelho'</tt> </tt>
<a name="L11"></a><tt class="py-lineno">11</tt>  <tt class="py-line"> </tt>
<a name="L12"></a><tt class="py-lineno">12</tt>  <tt class="py-line"><tt class="py-keyword">import</tt> <tt class="py-name">unittest</tt> </tt>
<a name="L13"></a><tt class="py-lineno">13</tt>  <tt class="py-line"><tt class="py-keyword">from</tt> <tt id="link-0" class="py-name" targets="Package pypln.pypln.workers=pypln.pypln.workers-module.html"><a title="pypln.pypln.workers" class="py-name" href="#" onclick="return doclink('link-0', 'workers', 'link-0');">workers</a></tt><tt class="py-op">.</tt><tt id="link-1" class="py-name" targets="Module pypln.pypln.workers.highlighter_worker=pypln.pypln.workers.highlighter_worker-module.html"><a title="pypln.pypln.workers.highlighter_worker" class="py-name" href="#" onclick="return doclink('link-1', 'highlighter_worker', 'link-1');">highlighter_worker</a></tt> <tt class="py-keyword">import</tt> <tt id="link-2" class="py-name" targets="Class pypln.pypln.workers.highlighter_worker.HighlighterWorker=pypln.pypln.workers.highlighter_worker.HighlighterWorker-class.html"><a title="pypln.pypln.workers.highlighter_worker.HighlighterWorker" class="py-name" href="#" onclick="return doclink('link-2', 'HighlighterWorker', 'link-2');">HighlighterWorker</a></tt> </tt>
<a name="L14"></a><tt class="py-lineno">14</tt>  <tt class="py-line"> </tt>
<a name="TestHighlighterWorker"></a><div id="TestHighlighterWorker-def"><a name="L15"></a><tt class="py-lineno">15</tt> <a class="py-toggle" href="#" id="TestHighlighterWorker-toggle" onclick="return toggle('TestHighlighterWorker');">-</a><tt class="py-line"><tt class="py-keyword">class</tt> <a class="py-def-name" href="pypln.pypln.test_worker_processes.TestHighlighterWorker-class.html">TestHighlighterWorker</a><tt class="py-op">(</tt><tt class="py-base-class">unittest</tt><tt class="py-op">.</tt><tt class="py-base-class">TestCase</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
</div><div id="TestHighlighterWorker-collapsed" style="display:none;" pad="++" indent="++++"></div><div id="TestHighlighterWorker-expanded"><a name="TestHighlighterWorker.setUp"></a><div id="TestHighlighterWorker.setUp-def"><a name="L16"></a><tt class="py-lineno">16</tt> <a class="py-toggle" href="#" id="TestHighlighterWorker.setUp-toggle" onclick="return toggle('TestHighlighterWorker.setUp');">-</a><tt class="py-line">    <tt class="py-keyword">def</tt> <a class="py-def-name" href="pypln.pypln.test_worker_processes.TestHighlighterWorker-class.html#setUp">setUp</a><tt class="py-op">(</tt><tt class="py-param">self</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
</div><div id="TestHighlighterWorker.setUp-collapsed" style="display:none;" pad="++" indent="++++++++"></div><div id="TestHighlighterWorker.setUp-expanded"><a name="L17"></a><tt class="py-lineno">17</tt>  <tt class="py-line">        <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">W</tt> <tt class="py-op">=</tt> <tt id="link-3" class="py-name"><a title="pypln.pypln.workers.highlighter_worker.HighlighterWorker" class="py-name" href="#" onclick="return doclink('link-3', 'HighlighterWorker', 'link-2');">HighlighterWorker</a></tt><tt class="py-op">(</tt><tt class="py-op">)</tt> </tt>
</div><a name="TestHighlighterWorker.tearDown"></a><div id="TestHighlighterWorker.tearDown-def"><a name="L18"></a><tt class="py-lineno">18</tt> <a class="py-toggle" href="#" id="TestHighlighterWorker.tearDown-toggle" onclick="return toggle('TestHighlighterWorker.tearDown');">-</a><tt class="py-line">    <tt class="py-keyword">def</tt> <a class="py-def-name" href="pypln.pypln.test_worker_processes.TestHighlighterWorker-class.html#tearDown">tearDown</a><tt class="py-op">(</tt><tt class="py-param">self</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
</div><div id="TestHighlighterWorker.tearDown-collapsed" style="display:none;" pad="++" indent="++++++++"></div><div id="TestHighlighterWorker.tearDown-expanded"><a name="L19"></a><tt class="py-lineno">19</tt>  <tt class="py-line">        <tt class="py-keyword">pass</tt> </tt>
</div><a name="L20"></a><tt class="py-lineno">20</tt>  <tt class="py-line"> </tt>
<a name="TestHighlighterWorker.test_single_wordlist"></a><div id="TestHighlighterWorker.test_single_wordlist-def"><a name="L21"></a><tt class="py-lineno">21</tt> <a class="py-toggle" href="#" id="TestHighlighterWorker.test_single_wordlist-toggle" onclick="return toggle('TestHighlighterWorker.test_single_wordlist');">-</a><tt class="py-line">    <tt class="py-keyword">def</tt> <a class="py-def-name" href="pypln.pypln.test_worker_processes.TestHighlighterWorker-class.html#test_single_wordlist">test_single_wordlist</a><tt class="py-op">(</tt><tt class="py-param">self</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
</div><div id="TestHighlighterWorker.test_single_wordlist-collapsed" style="display:none;" pad="++" indent="++++++++"></div><div id="TestHighlighterWorker.test_single_wordlist-expanded"><a name="L22"></a><tt class="py-lineno">22</tt>  <tt class="py-line">        <tt class="py-name">msg</tt> <tt class="py-op">=</tt> <tt class="py-op">{</tt><tt class="py-string">'text'</tt><tt class="py-op">:</tt><tt class="py-op">[</tt><tt class="py-string">'atirei'</tt><tt class="py-op">,</tt><tt class="py-string">'o'</tt><tt class="py-op">,</tt><tt class="py-string">'pau'</tt><tt class="py-op">,</tt><tt class="py-string">'no'</tt><tt class="py-op">,</tt><tt class="py-string">'gato'</tt><tt class="py-op">]</tt><tt class="py-op">,</tt><tt class="py-string">'wordlists'</tt><tt class="py-op">:</tt><tt class="py-op">{</tt><tt class="py-string">'um'</tt><tt class="py-op">:</tt><tt class="py-op">[</tt><tt class="py-string">'pau'</tt><tt class="py-op">,</tt><tt class="py-string">'gato'</tt><tt class="py-op">]</tt><tt class="py-op">}</tt><tt class="py-op">}</tt> </tt>
<a name="L23"></a><tt class="py-lineno">23</tt>  <tt class="py-line">        <tt class="py-name">res</tt> <tt class="py-op">=</tt> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">W</tt><tt class="py-op">.</tt><tt id="link-4" class="py-name" targets="Method pypln.pypln.sinks.base.BaseSink.process()=pypln.pypln.sinks.base.BaseSink-class.html#process,Method pypln.pypln.sinks.mongo_insert_sink.MongoInsertSink.process()=pypln.pypln.sinks.mongo_insert_sink.MongoInsertSink-class.html#process,Method pypln.pypln.sinks.mongo_update_sink.MongoUpdateSink.process()=pypln.pypln.sinks.mongo_update_sink.MongoUpdateSink-class.html#process,Method pypln.pypln.sinks.raw_document_sink.RawDocumentSink.process()=pypln.pypln.sinks.raw_document_sink.RawDocumentSink-class.html#process,Method pypln.pypln.workers.base.BaseWorker.process()=pypln.pypln.workers.base.BaseWorker-class.html#process,Method pypln.pypln.workers.base.PushPullWorker.process()=pypln.pypln.workers.base.PushPullWorker-class.html#process,Method pypln.pypln.workers.dummy_worker.DummyWorker.process()=pypln.pypln.workers.dummy_worker.DummyWorker-class.html#process,Method pypln.pypln.workers.enc_detect_worker.EncodingWorker.process()=pypln.pypln.workers.enc_detect_worker.EncodingWorker-class.html#process,Method pypln.pypln.workers.highlighter_worker.HighlighterWorker.process()=pypln.pypln.workers.highlighter_worker.HighlighterWorker-class.html#process,Method pypln.pypln.workers.mime_detect_worker.MimeWorker.process()=pypln.pypln.workers.mime_detect_worker.MimeWorker-class.html#process,Method pypln.pypln.workers.palavras_worker.Palavras_worker.process()=pypln.pypln.workers.palavras_worker.Palavras_worker-class.html#process,Method pypln.pypln.workers.parser_worker.ParserWorker.process()=pypln.pypln.workers.parser_worker.ParserWorker-class.html#process,Method pypln.pypln.workers.pdfconv_worker.PDFConverterWorker.process()=pypln.pypln.workers.pdfconv_worker.PDFConverterWorker-class.html#process,Method pypln.pypln.workers.tagger_worker.POSTaggerWorker.process()=pypln.pypln.workers.tagger_worker.POSTaggerWorker-class.html#process"><a title="pypln.pypln.sinks.base.BaseSink.process
pypln.pypln.sinks.mongo_insert_sink.MongoInsertSink.process
pypln.pypln.sinks.mongo_update_sink.MongoUpdateSink.process
pypln.pypln.sinks.raw_document_sink.RawDocumentSink.process
pypln.pypln.workers.base.BaseWorker.process
pypln.pypln.workers.base.PushPullWorker.process
pypln.pypln.workers.dummy_worker.DummyWorker.process
pypln.pypln.workers.enc_detect_worker.EncodingWorker.process
pypln.pypln.workers.highlighter_worker.HighlighterWorker.process
pypln.pypln.workers.mime_detect_worker.MimeWorker.process
pypln.pypln.workers.palavras_worker.Palavras_worker.process
pypln.pypln.workers.parser_worker.ParserWorker.process
pypln.pypln.workers.pdfconv_worker.PDFConverterWorker.process
pypln.pypln.workers.tagger_worker.POSTaggerWorker.process" class="py-name" href="#" onclick="return doclink('link-4', 'process', 'link-4');">process</a></tt><tt class="py-op">(</tt><tt class="py-name">msg</tt><tt class="py-op">)</tt> </tt>
<a name="L24"></a><tt class="py-lineno">24</tt>  <tt class="py-line">        <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">assertDictEqual</tt><tt class="py-op">(</tt><tt class="py-name">res</tt><tt class="py-op">,</tt><tt class="py-op">{</tt><tt class="py-string">'highlighted_text'</tt><tt class="py-op">:</tt><tt class="py-op">[</tt><tt class="py-string">'atirei'</tt><tt class="py-op">,</tt><tt class="py-string">'o'</tt><tt class="py-op">,</tt><tt class="py-string">'&lt;span class="tagged" title="um"&gt;&lt;b&gt;pau&lt;/b&gt;&lt;/span&gt;'</tt><tt class="py-op">,</tt> </tt>
<a name="L25"></a><tt class="py-lineno">25</tt>  <tt class="py-line">                                                  <tt class="py-string">'no'</tt><tt class="py-op">,</tt><tt class="py-string">'&lt;span class="tagged" title="um"&gt;&lt;b&gt;gato&lt;/b&gt;&lt;/span&gt;'</tt><tt class="py-op">]</tt><tt class="py-op">}</tt><tt class="py-op">)</tt> </tt>
</div><a name="L26"></a><tt class="py-lineno">26</tt>  <tt class="py-line"> </tt>
<a name="TestHighlighterWorker.test_multiple_wordlist"></a><div id="TestHighlighterWorker.test_multiple_wordlist-def"><a name="L27"></a><tt class="py-lineno">27</tt> <a class="py-toggle" href="#" id="TestHighlighterWorker.test_multiple_wordlist-toggle" onclick="return toggle('TestHighlighterWorker.test_multiple_wordlist');">-</a><tt class="py-line">    <tt class="py-keyword">def</tt> <a class="py-def-name" href="pypln.pypln.test_worker_processes.TestHighlighterWorker-class.html#test_multiple_wordlist">test_multiple_wordlist</a><tt class="py-op">(</tt><tt class="py-param">self</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
</div><div id="TestHighlighterWorker.test_multiple_wordlist-collapsed" style="display:none;" pad="++" indent="++++++++"></div><div id="TestHighlighterWorker.test_multiple_wordlist-expanded"><a name="L28"></a><tt class="py-lineno">28</tt>  <tt class="py-line">        <tt class="py-name">msg</tt> <tt class="py-op">=</tt> <tt class="py-op">{</tt><tt class="py-string">'text'</tt><tt class="py-op">:</tt><tt class="py-op">[</tt><tt class="py-string">'atirei'</tt><tt class="py-op">,</tt><tt class="py-string">'o'</tt><tt class="py-op">,</tt><tt class="py-string">'pau'</tt><tt class="py-op">,</tt><tt class="py-string">'no'</tt><tt class="py-op">,</tt><tt class="py-string">'gato'</tt><tt class="py-op">]</tt><tt class="py-op">,</tt> </tt>
<a name="L29"></a><tt class="py-lineno">29</tt>  <tt class="py-line">               <tt class="py-string">'wordlists'</tt><tt class="py-op">:</tt><tt class="py-op">{</tt><tt class="py-string">'um'</tt><tt class="py-op">:</tt><tt class="py-op">[</tt><tt class="py-string">'pau'</tt><tt class="py-op">,</tt><tt class="py-string">'gato'</tt><tt class="py-op">]</tt><tt class="py-op">,</tt><tt class="py-string">'dois'</tt><tt class="py-op">:</tt><tt class="py-op">[</tt><tt class="py-string">'pau'</tt><tt class="py-op">,</tt><tt class="py-string">'cachorro'</tt><tt class="py-op">]</tt><tt class="py-op">}</tt><tt class="py-op">}</tt> </tt>
<a name="L30"></a><tt class="py-lineno">30</tt>  <tt class="py-line">        <tt class="py-name">res</tt> <tt class="py-op">=</tt> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">W</tt><tt class="py-op">.</tt><tt id="link-5" class="py-name"><a title="pypln.pypln.sinks.base.BaseSink.process
pypln.pypln.sinks.mongo_insert_sink.MongoInsertSink.process
pypln.pypln.sinks.mongo_update_sink.MongoUpdateSink.process
pypln.pypln.sinks.raw_document_sink.RawDocumentSink.process
pypln.pypln.workers.base.BaseWorker.process
pypln.pypln.workers.base.PushPullWorker.process
pypln.pypln.workers.dummy_worker.DummyWorker.process
pypln.pypln.workers.enc_detect_worker.EncodingWorker.process
pypln.pypln.workers.highlighter_worker.HighlighterWorker.process
pypln.pypln.workers.mime_detect_worker.MimeWorker.process
pypln.pypln.workers.palavras_worker.Palavras_worker.process
pypln.pypln.workers.parser_worker.ParserWorker.process
pypln.pypln.workers.pdfconv_worker.PDFConverterWorker.process
pypln.pypln.workers.tagger_worker.POSTaggerWorker.process" class="py-name" href="#" onclick="return doclink('link-5', 'process', 'link-4');">process</a></tt><tt class="py-op">(</tt><tt class="py-name">msg</tt><tt class="py-op">)</tt> </tt>
<a name="L31"></a><tt class="py-lineno">31</tt>  <tt class="py-line">        <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">assertDictEqual</tt><tt class="py-op">(</tt><tt class="py-name">res</tt><tt class="py-op">,</tt><tt class="py-op">{</tt><tt class="py-string">'highlighted_text'</tt><tt class="py-op">:</tt><tt class="py-op">[</tt><tt class="py-string">'atirei'</tt><tt class="py-op">,</tt><tt class="py-string">'o'</tt><tt class="py-op">,</tt><tt class="py-string">'&lt;span class="tagged" title="um,dois"&gt;&lt;b&gt;pau&lt;/b&gt;&lt;/span&gt;'</tt><tt class="py-op">,</tt> </tt>
<a name="L32"></a><tt class="py-lineno">32</tt>  <tt class="py-line">                                                  <tt class="py-string">'no'</tt><tt class="py-op">,</tt><tt class="py-string">'&lt;span class="tagged" title="um"&gt;&lt;b&gt;gato&lt;/b&gt;&lt;/span&gt;'</tt><tt class="py-op">]</tt><tt class="py-op">}</tt><tt class="py-op">)</tt> </tt>
</div></div><a name="L33"></a><tt class="py-lineno">33</tt>  <tt class="py-line"> </tt>
<a name="L34"></a><tt class="py-lineno">34</tt>  <tt class="py-line"><tt class="py-keyword">if</tt> <tt class="py-name">__name__</tt> <tt class="py-op">==</tt> <tt class="py-string">'__main__'</tt><tt class="py-op">:</tt> </tt>
<a name="L35"></a><tt class="py-lineno">35</tt>  <tt class="py-line">    <tt class="py-name">unittest</tt><tt class="py-op">.</tt><tt class="py-name">main</tt><tt class="py-op">(</tt><tt class="py-op">)</tt> </tt>
<a name="L36"></a><tt class="py-lineno">36</tt>  <tt class="py-line"> </tt><script type="text/javascript">
<!--
expandto(location.href);
// -->
</script>
</pre>
<br />
<!-- ==================== NAVIGATION BAR ==================== -->
<table class="navbar" border="0" width="100%" cellpadding="0"
       bgcolor="#a0c0ff" cellspacing="0">
  <tr valign="middle">

  <!-- Tree link -->
      <th>&nbsp;&nbsp;&nbsp;<a
        href="module-tree.html">Trees</a>&nbsp;&nbsp;&nbsp;</th>

  <!-- Index link -->
      <th>&nbsp;&nbsp;&nbsp;<a
        href="identifier-index.html">Indices</a>&nbsp;&nbsp;&nbsp;</th>

  <!-- Help link -->
      <th>&nbsp;&nbsp;&nbsp;<a
        href="help.html">Help</a>&nbsp;&nbsp;&nbsp;</th>

  <!-- Project homepage -->
      <th class="navbar" align="right" width="100%">
        <table border="0" cellpadding="0" cellspacing="0">
          <tr><th class="navbar" align="center"
            ><a class="navbar" target="_top" href="http://code.google.com/p/pypln">Project Homepage</a></th>
          </tr></table></th>
  </tr>
</table>
<table border="0" cellpadding="0" cellspacing="0" width="100%%">
  <tr>
    <td align="left" class="footer">
    Generated by Epydoc 3.0.1 on Sat Mar 31 10:39:43 2012
    </td>
    <td align="right" class="footer">
      <a target="mainFrame" href="http://epydoc.sourceforge.net"
        >http://epydoc.sourceforge.net</a>
    </td>
  </tr>
</table>

<script type="text/javascript">
  <!--
  // Private objects are initially displayed (because if
  // javascript is turned off then we want them to be
  // visible); but by default, we want to hide them.  So hide
  // them unless we have a cookie that says to show them.
  checkCookie();
  // -->
</script>
</body>
</html>
